<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
    <style>
      /*enter->enter-active->enter-to 从无到有
      leave->leave-active->leave-to 从有到无*/
      .v-enter-active,
      .v-leave-active {
        transition: opacity 1s;
      }
  
      .v-enter,
      .v-leave-to {
        opacity: 0;
      }
    </style>
</head>
<body>
    <!-- 动画  单元素/组件过渡 -->
    <div id="app">
        <button @click="show=!show">按钮</button>
        <transition>
            <p v-if="show">hello</p>
        </transition>
    </div>
    <script>
        var app = new Vue({
            el:'#app',
            data:{
                show:true
            }
        })
    </script>
</body>
</html>